import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.beans.Transient;

import javax.swing.JComponent;

public class ServerCanvas extends JComponent {
	/**
	 * 
	 */
	private static final long serialVersionUID = -161579618517275002L;
	int x, y, width,height,radius;
	boolean rectkind;

	@Override
	protected void paintComponent(Graphics g) {
		super.paintComponent(g);
		g.setColor(Color.black);
		if (!rectkind)
		   g.drawOval(x, y, radius * 2, radius * 2);
		else
		   g.drawRect(x, y, width, height);
	}

	protected void drawCircle(int x, int y, int radius){
		this.x=x;
		this.y=y;
		this.radius = radius;
		rectkind = false;
		repaint(); 	
	}
	
	public void drawRectangle(int x, int y, int width,
			int height) {
		this.x=x;
		this.y=y;
		this.width = width;
		this.height = height;
		rectkind = true;
		repaint(); 	
	}
	
	@Override
	@Transient
	public Dimension getMinimumSize() {
		return getPreferredSize();
	}

	@Override
	@Transient
	public Dimension getPreferredSize() {
		return new Dimension(400,600);
	}

}
